#配制excel表标题索引
import configparser
import os
class Config():
    def __init__(self):
        self.config=configparser.ConfigParser()
        self.conf_path=os.path.join(os.path.dirname(os.path.abspath(__file__)),'conf.ini')#获取制定配置文件所在路径
        self.config.read(self.conf_path,encoding='utf-8-sig')#读取配置文件，编码格式为utf-8
        self.conf={'id':'0', 'case_name':'1','url':'2','cookie':'3','token':'4','is_header':'5',
                   'is_run':'6','data':'7','method':'8','depend_case':'9','depend_data':'10',
                   'depend_key':'11','expect':'12','response':'13','result':'14','set_up':'15'}

    def get_conf(self):
        self.conf['id']=self.config.get("table","id")
        self.conf['case_name']=self.config.get("table","case_name")
        self.conf['url']=self.config.get("table","url")
        self.conf['cookie']=self.config.get("table","cookie")
        self.conf['token'] = self.config.get("table", "token")
        self.conf['is_header']=self.config.get("table","is_header")
        self.conf['is_run']=self.config.get("table","is_run")
        self.conf['data']=self.config.get("table","data")
        self.conf['method']=self.config.get("table","method")
        self.conf['depend_case']=self.config.get("table","depend_case")
        self.conf['depend_data']=self.config.get("table","depend_data")
        self.conf['depend_key']=self.config.get("table","depend_key")
        self.conf['expect']=self.config.get("table","expect")
        self.conf['response'] = self.config.get("table", "response")
        self.conf['result']=self.config.get("table","result")
        self.conf['set_up']=self.config.get("table","set_up")
        return self.conf
if __name__=="__main__":
    C=Config()
    print(C.get_conf())